package com.mianshi;

import java.util.Scanner;

public class alibaba2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int len = in.nextInt();
        int k = in.nextInt();
        int[] arr = new int[len];
        int[][] dp = new int[len][len]; ////在前i个中选长度为j的上升序列的个数
        for(int i = 0; i < len; i++){
            arr[i] = in.nextInt();
        }
        double NUMBER = (Math.pow(2,61) - 1);
        for(int i = 0; i < len; i++){
            dp[i][1] = i+1;
        }
        for(int i = 0; i < len; i++){
            for(int j = 1; j <= k;j++){
                for(int m = 0; m < len; m++){
                    if(arr[m] < arr[i]){
                        dp[i][j] = (int) ((dp[m][j-1] + dp[i][j]) % NUMBER);
                    }
                }
            }
        }
        System.out.println((int)(dp[len-1][k] % NUMBER));
    }
}
